﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Text;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using ATW.Bus;
using AnTeWei.Business;
using BUS;
using Com.Alipay;


/*
                          _ooOoo_
                         o8888888o
                         88" . "88
                         (| -_- |)
                         O\  =  /O
                      ____/`---'\____
                    .'  \\|     |//  `.
                   /  \\|||  :  |||//  \
                   /  _||||| -:- |||||-  \
                   |   | \\\  -  /// |   |
                   | \_|  ''\---/''  |   |
                   \  .-\__  `-`  ___/-. /
                   ___`. .'  /--.--\  `. . __
               ."" '<  `.___\_<|>_/___.'  >'"".
               | | :  `- \`.;`\ _ /`;.`/ - ` : | |
               \  \ `-.   \_ __\ /__ _/   .-` /  /
       ======`-.____`-.___\_____/___.-`____.-'======
                           `=---='
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        佛祖保佑       永无BUG
        */
namespace AnTeWei.AppInterface
{
    /// <summary>
    /// AppPortal 的摘要说明
    /// </summary>
    public class AppPortal1 : IHttpHandler
    {
        CommonHelp _commonhelp = new CommonHelp();
        Validation _Validation = new Validation();
        public void ProcessRequest(HttpContext context)
        {
            #region 起始
            context.Response.ContentType = "text/plain";

            StringBuilder sbLog = new StringBuilder();
            foreach (string key in context.Request.Form.AllKeys)
                sbLog.AppendFormat("{0}={1},", key, context.Request.Form[key]);

            DBLog.WriteDBLog("AshxPortalRequest", sbLog.ToString(), "");

            string method = context.Request.Form["Method"];
            //判断是否传递Method参数，用于区分调用具体方法
            if (string.IsNullOrWhiteSpace(method))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "没有传入参数 Method", "AshxPortalRequest");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            #endregion

            #region 根据method参数值调用方法
            switch (method)
            {
                #region 基础部分
                //注册、完善App用户
                case "Register":
                    Register(context);
                    break;
                //修改密码
                case "UpdatePwd":
                    UpdatePwd(context);
                    break;
                //找回密码
                case "ResetPwd":
                    ResetPwd(context);
                    break;
                //短信验证
                case "GetMessage":
                    GetMessage(context);
                    break;
                //登录
                case "Login":
                    Login(context);
                    break;
                //推送消息
                case "SendMessage":
                    SendMessage(context);
                    break;
                //查询消息记录
                case "SelectMessage":
                    SelectMessage(context);
                    break;
                //查询消息是否已读
                case "CheckMessage":
                    CheckMessage(context);
                    break;
                #endregion

                #region 八大模块app
                //查询类别
                case "SelectCategory":
                    SelectCategory(context);
                    break;
                //查询子项
                case "SelectItem":
                    SelectItem(context);
                    break;
                //查询国别
                case "SelectCountry":
                    SelectCountry(context);
                    break;
                //查询省市区
                case "SelectAddress":
                    SelectAddress(context);
                    break;
                //查询基础参数
                case "SelectFoundation":
                    SelectFoundation(context);
                    break;
                //发布需求
                //case "DemandInformation":
                //    DemandInformation(context);
                //    break;
                //查询需求
                case "SelectInformation":
                    SelectInformation(context);
                    break;

                //设置闹钟
                case "SetClock":
                    SetClock(context);
                    break;

                //查询闹钟
                case "SelectClock":
                    SelectClock(context);
                    break;


                //根据tdiNo查询需求明细
                case "SelectInformationList":
                    SelectInformationList(context);
                    break;
                //查询竞标
                case "SelectBid":
                    SelectBid(context);
                    break;
                //根据tdibNo查询竞标明细
                case "SelectBidList":
                    SelectBidList(context);
                    break;
                //根据模块类型查询需求
                case "SelectByType":
                    SelectByType(context);
                    break;
                //投标
                case "PublishBid":
                    PublishBid(context);
                    break;

                //我的参与
                case "MyPart":
                    MyPart(context);
                    break;

                //我的合同
                case "PurchaseContract":
                    PurchaseContract(context);
                    break;


                //合同详情
                case "ContractDetail":
                    ContractDetail(context);
                    break;


                #endregion

                #region 销售app
                //销售登录
                case "SalesLogin":
                    SalesLogin(context);
                    break;
                //验证邀请码是否存在
                case "CheckCode":
                    CheckCode(context);
                    break;
                //销售app注册
                case "SalesRegister":
                    SalesRegister(context);
                    break;
                //获取系统参数
                case "SelectSystemArgs":
                    SelectSystemArgs(context);
                    break;
                //获取产品参数
                case "SelectProductionArgs":
                    SelectProductionArgs(context);
                    break;
                //客户端首页查询
                case "SelectClientFirst":
                    SelectClientFirst(context);
                    break;
                //查询询价单明细
                case "SelectRequestDetail":
                    SelectRequestDetail(context);
                    break;
                //确认报价接口
                case "ConfirmResponse":
                    ConfirmResponse(context);
                    break;
                //删除询价
                case "DeleteRequest":
                    DeleteRequest(context);
                    break;
                //合同查询
                case "SelectContract":
                    SelectContract(context);
                    break;
                //确认合同
                case "ConfirmContract":
                    ConfirmContract(context);
                    break;
                //我的待办查询
                case "SelectTodo":
                    SelectTodo(context);
                    break;
                //我的成交
                case "SelectDone":
                    SelectDone(context);
                    break;
                //发布询价接口
                case "CreateRequest":
                    CreateRequest(context);
                    break;
                //热门搜索查询
                case "SelectHot":
                    SelectHot(context);
                    break;
                //分供商首页查询
                case "SelectSupFirst":
                    SelectSupFirst(context);
                    break;
                //报价明细查询查询
                case "SelectResponseDetail":
                    SelectResponseDetail(context);
                    break;
                //报价接口
                case "CreateResponse":
                    CreateResponse(context);
                    break;
                //查询成交详情
                case "SelectDoneList":
                    SelectDoneList(context);
                    break;
                //查询供货范围产品
                case "SelectSupplyRange":
                    SelectSupplyRange(context);
                    break;
                //查询供货范围明细
                case "SelectSupplyRangeDetail":
                    SelectSupplyRangeDetail(context);
                    break;
                //添加删除供货范围
                case "EditSupplyRange":
                    EditSupplyRange(context);
                    break;
                //销售端首页
                case "SelectSalesFirst":
                    SelectSalesFirst(context);
                    break;
                //查询客户接口
                case "SelectClients":
                    SelectClients(context);
                    break;
                //客户处理
                case "ContactClients":
                    ContactClients(context);
                    break;
                //查询客户联系、关怀记录
                case "SelectConcern":
                    SelectConcern(context);
                    break;
                //更改客户标签
                case "EditClients":
                    EditClients(context);
                    break;
                //分供商提交异常
                case "CreateException":
                    CreateException(context);
                    break;
                //查询异常
                case "SelectException":
                    SelectException(context);
                    break;
                #endregion
    
            }
            #endregion         
        }

        #region 八大模块接口
        /// <summary>
        /// 注册、完善App用户
        /// </summary>
        /// <param name="context"></param>
        public void Register(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string strError = "";
            //检查参数TAppUser类及OperationType是否都有值
            if (string.IsNullOrWhiteSpace(context.Request.Form["JsonTAppUser"]) || string.IsNullOrWhiteSpace(context.Request.Form["OperationType"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数不完整", "AshxPortalRequest - Register");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            //反序列化类TAppUser
            T_AppUser TAppUser = JsonConvert.DeserializeObject<T_AppUser>(context.Request.Form["JsonTAppUser"].ToString());

            DBLog.WriteDBLog("AshxPortalRequest - Register", "监测T_AppUser类", context.Request.Form["JsonTAppUser"].ToString());

            //校验TAppUser类关键参数是否为空
            if (!_Validation.Register(TAppUser, context.Request.Form["OperationType"], ref strError))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - Register");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }

            //根据OperationType区分调用注册及完善方法:1.注册个人信息;2.完善个人信息
            if (context.Request.Form["OperationType"] == "1")
            {
                context.Response.Write(new AppPortal().InsertAppUser(TAppUser));
                return;
            }
            else if (context.Request.Form["OperationType"] == "2")
            {
                context.Response.Write(new AppPortal().UpdateAppUser(TAppUser));
                return;
            }
            else
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数OperationType不正确", "AshxPortalRequest - Register");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
        }

        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="context"></param>
        public void Login(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string strError = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]) || string.IsNullOrWhiteSpace(context.Request.Form["tauPwd"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数错误", "AshxPortalRequest - Login");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strTauLoginId = context.Request.Form["tauLoginId"].ToString();
            string strTauPwd = context.Request.Form["tauPwd"].ToString();
            //校验TAppUser类关键参数是否为空
            if (!_Validation.Login(strTauLoginId, strTauPwd, ref strError))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - Register");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            context.Response.Write(new AppPortal().Login(strTauLoginId, strTauPwd));
            return;
        }

        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="context"></param>
        public void UpdatePwd(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string strError = "";

            //校验TAppUser类关键参数是否为空
            if (!_Validation.UpdatePwd(context, ref strError))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - UpdatePwd");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }

            string strLoginId = context.Request.Form["tauLoginId"].ToString();
            string strNewPwd = context.Request.Form["NewPwd"].ToString();
            string strOldPwd = context.Request.Form["OldPwd"].ToString();

            context.Response.Write(new AppPortal().UpdatePwd(strLoginId, strNewPwd, strOldPwd));
            return;

        }

        /// <summary>
        /// 重置密码
        /// </summary>
        /// <param name="context"></param>
        public void ResetPwd(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string strError = "";


            //校验ResetPwd关键参数是否为空
            if (!_Validation.ResetPwd(context, ref strError))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - ResetPwd");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }

            string strLoginId = context.Request.Form["tauLoginId"].ToString();
            string strNewPwd = context.Request.Form["NewPwd"].ToString();

            context.Response.Write(new AppPortal().ResetPwd(strLoginId, strNewPwd));
            return;

        }

        /// <summary>
        /// 短信验证
        /// </summary>
        /// <param name="context"></param>
        public void GetMessage(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string strError = "";


            //校验GetMessage关键参数是否为空
            if (!_Validation.GetMessage(context, ref strError))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - GetMessage");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }

            string strLoginId = context.Request.Form["tauLoginId"].ToString();

            //区分 0 国内客户 或者 1 国外客户
            string strType = context.Request.Form["Type"].ToString();

            //根据OperationType区分调用注册及完善方法:1.获取注册验证码;2.获取找回验证码
            context.Response.Write(new AppPortal().GetMessage(strLoginId, strType));
            return;


        }

        /// <summary>
        /// 查询类别（废弃）
        /// </summary>
        /// <param name="context"></param>
        public void SelectCategory(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string strLoginId = "";
            if (!string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                strLoginId = context.Request.Form["tauLoginId"].ToString();
            }


            context.Response.Write(new AppPortal().SelectCategory(strLoginId));
            return;
        }

        /// <summary>
        /// 查询子项（不用根据类别去查）
        /// </summary>
        /// <param name="context"></param>
        public void SelectItem(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (string.IsNullOrWhiteSpace(context.Request.Form["TICID"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数TICID不能为空", "AshxPortalRequest - SelectItem");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strTicId = context.Request.Form["TICID"].ToString();
            context.Response.Write(new AppPortal().SelectItem(strTicId));
            return;
        }

        /// <summary>
        /// 查询国别
        /// </summary>
        /// <param name="context"></param>
        public void SelectCountry(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            context.Response.Write(new AppPortal().SelectCountry());
            return;
        }

        /// <summary>
        /// 查询省市区
        /// </summary>
        /// <param name="context"></param>
        public void SelectAddress(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            //string strProvince ="";
            //string strCity ="";

            //if (!string.IsNullOrWhiteSpace(context.Request.Form["Province"]))
            //{
            //    strProvince = context.Request.Form["Province"].ToString();
            //}
            //if (!string.IsNullOrWhiteSpace(context.Request.Form["City"]))
            //{
            //    strCity = context.Request.Form["City"].ToString();
            //}



            context.Response.Write(new AppPortal().SelectAddress());
            return;
        }

        /// <summary>
        /// 查询基础参数
        /// </summary>
        /// <param name="context"></param>
        public void SelectFoundation(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            if (string.IsNullOrWhiteSpace(context.Request.Form["Type"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数Type不能为空", "AshxPortalRequest - SelectFoundation");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strType = context.Request.Form["Type"].ToString();

            context.Response.Write(new AppPortal().SelectFoundation(strType));
            return;
        }

        /// <summary>
        /// 发布需求
        /// </summary>
        /// <param name="context"></param>
        public void DemandInformation(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string strError = "";
            //检查参数JsonHead类、JsonList类及tauLoginId是否都有值
            if (string.IsNullOrWhiteSpace(context.Request.Form["JsonHead"]) || string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数不完整", "AshxPortalRequest - DemandInformation");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }

            //反序列化类T_DemandInformation、T_DemandInformationDetail
            T_DemandInformation TDeInfoHead = JsonConvert.DeserializeObject<T_DemandInformation>(context.Request.Form["JsonHead"].ToString());

            string strLoginId = context.Request.Form["tauLoginId"];

            //校验需求表头类关键参数是否为空
            if (!_Validation.DemandInformation(TDeInfoHead, ref strError))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - DemandInformation");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            if (string.IsNullOrWhiteSpace(context.Request.Form["JsonList"]))
            {

                context.Response.Write(new AppPortal().DemandInformation(TDeInfoHead, strLoginId));
                return;
            }
            else
            {
                List<T_DemandInformationDetail> TDeInfoList = JsonConvert.DeserializeObject<List<T_DemandInformationDetail>>(context.Request.Form["JsonList"].ToString());

                //校验需求表体类关键参数是否为空
                if (!_Validation.DemandInformation(TDeInfoList, ref strError))
                {
                    JObject jObj = new JObject();
                    jObj = Common.Return("-1", strError, "AshxPortalRequest - DemandInformation");
                    context.Response.Write(JsonConvert.SerializeObject(jObj));
                    return;
                }
                context.Response.Write(new AppPortal().DemandInformation(TDeInfoHead, TDeInfoList, strLoginId));
                return;

            }




        }

       

        

        /// <summary>
        /// 查询竞标
        /// </summary>
        /// <param name="context"></param>
        public void SelectBid(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            
            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数tauLoginId不能为空", "AshxPortalRequest - SelectBid");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            if (string.IsNullOrWhiteSpace(context.Request.Form["Type"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数Type不能为空", "AshxPortalRequest - SelectInformation");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strType = context.Request.Form["Type"].ToString();
            string strLoginId = context.Request.Form["tauLoginId"].ToString();

            context.Response.Write(new AppPortal().SelectBid(strType, strLoginId));
            return;
        }

        

       

        
        /// <summary>
        /// 推送消息
        /// </summary>
        /// <param name="context"></param>
        public void SendMessage(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string strError = "";
            //检查参数TAppUser类及OperationType是否都有值
            if (string.IsNullOrWhiteSpace(context.Request.Form["JsonMessage"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数不完整", "AshxPortalRequest - SendMessage");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }

            //检查参数TAppUser类及OperationType是否都有值
            if (string.IsNullOrWhiteSpace(context.Request.Form["Type"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数不完整", "AshxPortalRequest - SendMessage");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }

            //反序列化类T_Message
            T_Message TMessage = JsonConvert.DeserializeObject<T_Message>(context.Request.Form["JsonMessage"].ToString());
            string strType = context.Request.Form["Type"].ToString();


            //校验T_Message类关键参数是否为空
            if (!_Validation.SendMessage(TMessage, ref strError))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - SendMessage");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }


            context.Response.Write(new AppPortal().SendMessage(TMessage, strType));
            return;

        }

        /// <summary>
        /// 查询消息记录
        /// </summary>
        /// <param name="context"></param>
        public void SelectMessage(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数tauLoginId不能为空", "AshxPortalRequest - SelectMessage");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strLoginId = context.Request.Form["tauLoginId"].ToString();

            context.Response.Write(new AppPortal().SelectMessage(strLoginId));
            return;
        }

        /// <summary>
        /// 查询消息是否已读
        /// </summary>
        /// <param name="context"></param>
        public void CheckMessage(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            if (string.IsNullOrWhiteSpace(context.Request.Form["TmId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数TmId不能为空", "AshxPortalRequest - CheckMessage");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strTmId = context.Request.Form["TmId"].ToString();

            context.Response.Write(new AppPortal().CheckMessage(strTmId));
            return;
        }

        /// <summary>
        /// 设置闹钟
        /// </summary>
        /// <param name="context"></param>
        public void SetClock(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string strError = "";
            //检查参数TAppUser类及OperationType是否都有值
            if (string.IsNullOrWhiteSpace(context.Request.Form["JsonClock"]) || string.IsNullOrWhiteSpace(context.Request.Form["OperationType"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数不完整", "AshxPortalRequest - Register");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            //反序列化类TAppUser
            T_DemandUserClock TClock = JsonConvert.DeserializeObject<T_DemandUserClock>(context.Request.Form["JsonClock"].ToString());

            DBLog.WriteDBLog("AshxPortalRequest - Register", "监测T_DemandUserClock类", context.Request.Form["JsonClock"].ToString());

            ////校验TAppUser类关键参数是否为空
            //if (!_Validation.Register(TAppUser, context.Request.Form["OperationType"], ref strError))
            //{
            //    JObject jObj = new JObject();
            //    jObj = Common.Return("-1", strError, "AshxPortalRequest - Register");
            //    context.Response.Write(JsonConvert.SerializeObject(jObj));
            //    return;
            //}

            //根据OperationType区分调用注册及完善方法:1.注册个人信息;2.完善个人信息
            if (context.Request.Form["OperationType"] == "1")
            {
                Log.Debug("UpdateClock", "进去1");
                context.Response.Write(new AppPortal().SetClock(TClock));
                return;
            }
            else if (context.Request.Form["OperationType"] == "2")
            {
                Log.Debug("UpdateClock", "进去2");
                context.Response.Write(new AppPortal().UpdateClock(TClock));
                return;
            }
            else
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数OperationType不正确", "AshxPortalRequest - Register");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
        }

        /// <summary>
        /// 查询闹钟
        /// </summary>
        /// <param name="context"></param>
        public void SelectClock(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数tauLoginId不能为空", "AshxPortalRequest - SelectClock");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string tauLoginId = context.Request.Form["tauLoginId"].ToString();

            if (string.IsNullOrWhiteSpace(context.Request.Form["tdiNo"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数tdiNo不能为空", "AshxPortalRequest - SelectClock");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string tdiNo = context.Request.Form["tdiNo"].ToString();


            context.Response.Write(new AppPortal().SelectClock(tauLoginId,tdiNo));
            return;
        }

        #region 新八大模块
        /// <summary>
        /// 根据模块类型查询需求
        /// </summary>
        /// <param name="context"></param>
        public void SelectByType(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string strError = "";

            //校验关键参数是否为空
            if (!_Validation.SelectByType(context, ref strError))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - SelectByType");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }

            string strTicId = "";
            string strSearchKey = "";
            string strTdiId = "";
            string strTdiType = "";

            //string strTdiType = context.Request.Form["tdiType"].ToString();
            string strStatus = context.Request.Form["Status"].ToString();
            string strOrderBy = context.Request.Form["OrderBy"].ToString();
            //if (!string.IsNullOrWhiteSpace(context.Request.Form["TicId"]))
            //{
            //    strTicId = context.Request.Form["TicId"].ToString();
            //}
            string strCurrentPageIndex = context.Request.Form["CurrentPageIndex"].ToString();
            string strPageSize = context.Request.Form["PageSize"].ToString();
            if (!string.IsNullOrWhiteSpace(context.Request.Form["SearchKey"]))
            {
                strSearchKey = context.Request.Form["SearchKey"].ToString();
            }
            //if (!string.IsNullOrWhiteSpace(context.Request.Form["TdiId"]))
            //{
            //    strTdiId = context.Request.Form["TdiId"].ToString();
            //}

            context.Response.Write(new AppPortal().SelectByType(strTdiType, strStatus, strOrderBy, strTicId, strCurrentPageIndex, strPageSize, strSearchKey, strTdiId));
            return;
        }

        /// <summary>
        /// 查询需求
        /// </summary>
        /// <param name="context"></param>
        public void SelectInformation(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            if (string.IsNullOrWhiteSpace(context.Request.Form["Type"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数Type不能为空", "AshxPortalRequest - SelectInformation");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strType = context.Request.Form["Type"].ToString();

            context.Response.Write(new AppPortal().SelectInformation(strType));
            return;
        }

        /// <summary>
        /// 我的参与
        /// </summary>
        /// <param name="context"></param>
        public void MyPart(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数tauLoginId不能为空", "MyPart - MyPart");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strLoginId = context.Request.Form["tauLoginId"].ToString();

            context.Response.Write(new AppPortal().MyPart(strLoginId));
            return;
        }

         /// <summary>
        /// 我的合同
        /// </summary>
        /// <param name="context"></param>
        public void PurchaseContract(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数tauLoginId不能为空", "PurchaseContract - PurchaseContract");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strLoginId = context.Request.Form["tauLoginId"].ToString();

            context.Response.Write(new AppPortal().PurchaseContract(strLoginId));
            return;
        }

         /// <summary>
        /// 合同详情
        /// </summary>
        /// <param name="context"></param>
        public void ContractDetail(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            if (string.IsNullOrWhiteSpace(context.Request.Form["PContractID"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数PContractID不能为空", "PurchaseContract - PurchaseContract");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strPContractID = context.Request.Form["PContractID"].ToString();

            context.Response.Write(new AppPortal().ContractDetail(strPContractID));
            return;
        }


        /// <summary>
        /// 根据TdiId查询需求明细
        /// </summary>
        /// <param name="context"></param>
        public void SelectInformationList(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            if (string.IsNullOrWhiteSpace(context.Request.Form["TdiNo"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数TdiNo不能为空", "AshxPortalRequest - SelectInformationList");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strTdiNo = context.Request.Form["TdiNo"].ToString();

            context.Response.Write(new AppPortal().SelectInformationList(strTdiNo));
            return;
        }


        /// <summary>
        /// 查询竞标明细
        /// </summary>
        /// <param name="context"></param>
        public void SelectBidList(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            if (string.IsNullOrWhiteSpace(context.Request.Form["TdiNo"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数TdibNo不能为空", "AshxPortalRequest - SelectBidList");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strTdiNo = context.Request.Form["TdiNo"].ToString();

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数TdibNo不能为空", "AshxPortalRequest - SelectBidList");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string tauLoginId = context.Request.Form["tauLoginId"].ToString();

            context.Response.Write(new AppPortal().SelectBidList(strTdiNo, tauLoginId));
            return;
        }


        /// <summary>
        /// 投标
        /// </summary>
        /// <param name="context"></param>
        public void PublishBid(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            string strError = "";

            //检查参数JsonSupplyRange类及OperationType是否都有值
            if (string.IsNullOrWhiteSpace(context.Request.Form["JsonList"]))
            {

                JObject jObj = new JObject();
                jObj = Common.Return("-1", "传入参数不完整", "AshxPortalRequest - JsonList");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }

            //反序列化类T_Message
            List<T_DemandInformationBidDetail> ResponseList = JsonConvert.DeserializeObject<List<T_DemandInformationBidDetail>>(context.Request.Form["JsonList"].ToString());

            //校验T_Message类关键参数是否为空
            //if (!_Validation.CreateResponse(ResponseList, ref strError))
            //{
            //    JObject jObj = new JObject();
            //    jObj = Common.Return("-1", strError, "AshxPortalRequest - CreateResponse");
            //    context.Response.Write(JsonConvert.SerializeObject(jObj));
            //    return;
            //}


            context.Response.Write(new AppPortal().PublishBid(ResponseList));
            return;

        }


        #endregion

       
        #endregion

        #region 销售端接口
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="context"></param>
        public void SalesLogin(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - CheckCode");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]) || string.IsNullOrWhiteSpace(context.Request.Form["tauPwd"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - CheckCode");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strTauLoginId = context.Request.Form["tauLoginId"].ToString();
            string strTauPwd = context.Request.Form["tauPwd"].ToString();
            //校验TAppUser类关键参数是否为空
            if (!_Validation.SalesLogin(strLanId, strTauLoginId, strTauPwd, ref strError))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - Register");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            context.Response.Write(new AppPortal().SalesLogin(strLanId, strTauLoginId, strTauPwd));
            return;
        }

        /// <summary>
        /// 验证邀请码
        /// </summary>
        /// <param name="context"></param>
        public void CheckCode(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - CheckCode");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            if (string.IsNullOrWhiteSpace(context.Request.Form["Code"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - CheckCode");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strCode = context.Request.Form["Code"].ToString();

            if (!_Validation.CheckCode(strLanId, strCode, ref strError))
            {
                JObject jObj = new JObject();
                Log.Debug("20160416", strError);
                jObj = Common.Return("-1", strError, "AshxPortalRequest - Register");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            else
            {
                JObject jObj = new JObject();
                jObj = Common.Return("0", strError, "AshxPortalRequest - Register");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }

        }

        /// <summary>
        /// 销售app注册
        /// </summary>
        /// <param name="context"></param>
        public void SalesRegister(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            //检查参数TAppUser类及OperationType是否都有值
            if (string.IsNullOrWhiteSpace(context.Request.Form["JsonTAppUser"]) || string.IsNullOrWhiteSpace(context.Request.Form["OperationType"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SalesRegister");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            //反序列化类TAppUser
            T_AppUser TAppUser = JsonConvert.DeserializeObject<T_AppUser>(context.Request.Form["JsonTAppUser"].ToString());
            T_AppUser entity = new T_AppUser();
            

            //校验TAppUser类关键参数是否为空并根据实际情况获取销售邀请码及自身邀请码
            if (!_Validation.SalesRegister(strLanId, TAppUser, context.Request.Form["OperationType"], ref strError,ref entity))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - Register");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }

            //根据OperationType区分调用注册及完善方法:1.注册个人信息;2.完善个人信息
            if (context.Request.Form["OperationType"] == "1")
            {
                context.Response.Write(new AppPortal().InsertSalesAppUser(strLanId,entity));
                return;
            }
            else if (context.Request.Form["OperationType"] == "2")
            {
                context.Response.Write(new AppPortal().UpdateSalesAppUser(strLanId,entity));
                return;
            }
            else
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SalesRegister");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }


        }

        /// <summary>
        /// 获取系统参数
        /// </summary>
        /// <param name="context"></param>
        public void SelectSystemArgs(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion
            
            if (string.IsNullOrWhiteSpace(context.Request.Form["Type"]))
            {
                //获取多语言提示
                strTips=_commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strType = context.Request.Form["Type"].ToString();

            context.Response.Write(new AppPortal().SelectSystemArgs(strLanId,strType));
            return;
        }

        /// <summary>
        /// 获取产品参数
        /// </summary>
        public void SelectProductionArgs(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectProductionArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            string strKey =null;
            string strProductionId = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["Type"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectProductionArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strType = context.Request.Form["Type"].ToString();
            if (!string.IsNullOrWhiteSpace(context.Request.Form["SearchKey"]))
            {
                strKey = context.Request.Form["SearchKey"].ToString();
            }
            if (!string.IsNullOrWhiteSpace(context.Request.Form["ProductionId"]))
            {
                strProductionId = context.Request.Form["ProductionId"].ToString();
            }

            context.Response.Write(new AppPortal().SelectProductionArgs(strLanId, strType, strKey, strProductionId));
            return;
        }

        /// <summary>
        /// 客户端首页查询
        /// </summary>
        /// <param name="context"></param>
        public void SelectClientFirst(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            string strFromId = null;
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectClientFirst");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            if (!string.IsNullOrWhiteSpace(context.Request.Form["FromId"]))
            {
                strFromId=context.Request.Form["FromId"].ToString();
            }
            string strLoginId = context.Request.Form["tauLoginId"].ToString();

            context.Response.Write(new AppPortal().SelectClientFirst(strLanId, strLoginId, strFromId));
            return;
        }

        /// <summary>
        /// 查询询价单明细
        /// </summary>
        /// <param name="context"></param>
        public void SelectRequestDetail(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            if (string.IsNullOrWhiteSpace(context.Request.Form["RequestId"]))
            {
                //获取多语言提示
                strTips= _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectRequestDetail");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strRequestId = context.Request.Form["RequestId"].ToString();

            context.Response.Write(new AppPortal().SelectRequestDetail(strLanId, strRequestId));
            return;
        }

        /// <summary>
        /// 确认报价
        /// </summary>
        /// <param name="context"></param>
        public void ConfirmResponse(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - ConfirmResponse");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            //检查参数JsonList类是否有值
            if (string.IsNullOrWhiteSpace(context.Request.Form["JsonList"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - ConfirmResponse");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            
            //反序列化类T_Message
            List<T_ResponseDetail> ResponseList = JsonConvert.DeserializeObject<List<T_ResponseDetail>>(context.Request.Form["JsonList"].ToString());


            //校验T_Message类关键参数是否为空
            if (!_Validation.ConfirmResponse(strLanId, ResponseList, ref strError))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - ConfirmResponse");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }


            context.Response.Write(new AppPortal().ConfirmResponse(strLanId, ResponseList));
            return;
        }

        /// <summary>
        /// 删除询价
        /// </summary>
        /// <param name="context"></param>
        public void DeleteRequest(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            if (string.IsNullOrWhiteSpace(context.Request.Form["RequestId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectRequestDetail");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strRequestId = context.Request.Form["RequestId"].ToString();

            context.Response.Write(new AppPortal().DeleteRequest(strLanId, strRequestId));
            return;
        }

        /// <summary>
        /// 查询合同
        /// </summary>
        /// <param name="context"></param>
        public void SelectContract(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            if (string.IsNullOrWhiteSpace(context.Request.Form["ContractId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectContract");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strContractId = context.Request.Form["ContractId"].ToString();

            context.Response.Write(new AppPortal().SelectContract(strLanId, strContractId));
            return;
        }

        /// <summary>
        /// 确认合同
        /// </summary>
        /// <param name="context"></param>
        public void ConfirmContract(HttpContext context)
        {
            
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            
            if (string.IsNullOrWhiteSpace(context.Request.Form["ContractId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectContract");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strContractId = context.Request.Form["ContractId"].ToString();

            if (string.IsNullOrWhiteSpace(context.Request.Form["Type"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectContract");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strType = context.Request.Form["Type"].ToString();

            context.Response.Write(new AppPortal().ConfirmContract(strLanId, strContractId, strType));
            return;
        }

        /// <summary>
        /// 我的待办查询
        /// </summary>
        /// <param name="context"></param>
        public void SelectTodo(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion;

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectMessage");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strLoginId = context.Request.Form["tauLoginId"].ToString();

            if (string.IsNullOrWhiteSpace(context.Request.Form["Type"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectMessage");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strType = context.Request.Form["Type"].ToString();

            context.Response.Write(new AppPortal().SelectTodo(strLanId, strLoginId, strType));
            return;
        }

        /// <summary>
        /// 我的成交
        /// </summary>
        /// <param name="context"></param>
        public void SelectDone(HttpContext context)
        {
            string strFromId = null;
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion;

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectMessage");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strLoginId = context.Request.Form["tauLoginId"].ToString();

            if (string.IsNullOrWhiteSpace(context.Request.Form["Type"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectMessage");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strType = context.Request.Form["Type"].ToString();
            if (!string.IsNullOrWhiteSpace(context.Request.Form["FromId"]))
            {
                strFromId = context.Request.Form["FromId"].ToString();
            }
            context.Response.Write(new AppPortal().SelectDone(strLanId, strLoginId, strType, strFromId));
            return;
        }

        /// <summary>
        /// 发布询价接口
        /// </summary>
        /// <param name="context"></param>
        public void CreateRequest(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion
            

            //检查参数JsonSupplyRange类及OperationType是否都有值
            if (string.IsNullOrWhiteSpace(context.Request.Form["JsonHead"]) || string.IsNullOrWhiteSpace(context.Request.Form["JsonList"]))
            {
                
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - CreateRequest");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            T_Request RequestHead = new T_Request();
            List<T_RequestDetail> RequesList = new List<T_RequestDetail>();
            
            try 
            {
                //反序列化类T_Message
                RequestHead = JsonConvert.DeserializeObject<T_Request>(context.Request.Form["JsonHead"].ToString());
                RequesList = JsonConvert.DeserializeObject<List<T_RequestDetail>>(context.Request.Form["JsonList"].ToString());
            }
            catch (Exception ex)
            {
                Log.Debug("CreateRequest", ex.Message.ToString());
            }
            
            

            //校验T_Message类关键参数是否为空
            if (!_Validation.CreateRequest(strLanId, RequestHead, RequesList, ref strError))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - CreateRequest");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }


            context.Response.Write(new AppPortal().CreateRequest(strLanId, RequestHead, RequesList));
            return;

        }

        /// <summary>
        /// 热门搜索查询接口
        /// </summary>
        /// <param name="context"></param>
        public void SelectHot(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectHot");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            if (string.IsNullOrWhiteSpace(context.Request.Form["HotNum"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectHot");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }

            string strLoginId = context.Request.Form["tauLoginId"].ToString();
            string strHotNum = context.Request.Form["HotNum"].ToString();


            context.Response.Write(new AppPortal().SelectHot(strLanId, strLoginId, strHotNum));
        }

        /// <summary>
        /// 分供商首页查询
        /// </summary>
        /// <param name="context"></param>
        public void SelectSupFirst(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            string strFromId = null;
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectClientFirst");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            if (!string.IsNullOrWhiteSpace(context.Request.Form["FromId"]))
            {
                strFromId = context.Request.Form["FromId"].ToString();
            }
            string strLoginId = context.Request.Form["tauLoginId"].ToString();

            context.Response.Write(new AppPortal().SelectSupFirst(strLanId, strLoginId, strFromId));
        }

        /// <summary>
        /// 查询报价单明细
        /// </summary>
        /// <param name="context"></param>
        public void SelectResponseDetail(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            if (string.IsNullOrWhiteSpace(context.Request.Form["ResponseId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectResponseDetail");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strResponseId = context.Request.Form["ResponseId"].ToString();

            context.Response.Write(new AppPortal().SelectResponseDetail(strLanId, strResponseId));
            return;
        }

        /// <summary>
        /// 报价接口
        /// </summary>
        /// <param name="context"></param>
        public void CreateResponse(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            //检查参数JsonSupplyRange类及OperationType是否都有值
            if (string.IsNullOrWhiteSpace(context.Request.Form["JsonList"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - CreateResponse");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            
            //反序列化类T_Message
            List<T_ResponseDetail> ResponseList = JsonConvert.DeserializeObject<List<T_ResponseDetail>>(context.Request.Form["JsonList"].ToString());

            //校验T_Message类关键参数是否为空
            if (!_Validation.CreateResponse(strLanId, ResponseList, ref strError))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - CreateResponse");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }


            context.Response.Write(new AppPortal().CreateResponse(strLanId, ResponseList));
            return;
            
        }

        /// <summary>
        /// 查询成交详情
        /// </summary>
        /// <param name="context"></param>
        public void SelectDoneList(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            //if (string.IsNullOrWhiteSpace(context.Request.Form["RequestId"]))
            if (string.IsNullOrWhiteSpace(context.Request.Form["KeyId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectRequestDetail");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            //string strRequestId = context.Request.Form["RequestId"].ToString();
            string strKeyId = context.Request.Form["KeyId"].ToString();

            if (string.IsNullOrWhiteSpace(context.Request.Form["Type"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectRequestDetail");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strType = context.Request.Form["Type"].ToString();

            //context.Response.Write(new AppPortal().SelectDoneList(strLanId, strRequestId,strType));
            context.Response.Write(new AppPortal().SelectDoneList(strLanId, strKeyId, strType));
            return;
        }

        /// <summary>
        /// 查询供货范围
        /// </summary>
        /// <param name="context"></param>
        public void SelectSupplyRange(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion;

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectSupplyRange");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strLoginId = context.Request.Form["tauLoginId"].ToString();

            context.Response.Write(new AppPortal().SelectSupplyRange(strLanId, strLoginId));
            return;
        }

        /// <summary>
        /// 查询供货范围
        /// </summary>
        /// <param name="context"></param>
        public void SelectSupplyRangeDetail(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion;

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectSupplyRange");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strLoginId = context.Request.Form["tauLoginId"].ToString();

            if (string.IsNullOrWhiteSpace(context.Request.Form["ProductionID"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectSupplyRange");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strProductionID = context.Request.Form["ProductionID"].ToString();

            context.Response.Write(new AppPortal().SelectSupplyRangeDetail(strLanId, strLoginId, strProductionID));
            return;
        }

        /// <summary>
        /// 添加删除供货范围
        /// </summary>
        /// <param name="context"></param>
        public void EditSupplyRange(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion;

            //检查参数JsonSupplyRange类及OperationType是否都有值
            if (string.IsNullOrWhiteSpace(context.Request.Form["JsonSupplyCode"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - EditSupplyRange");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            //反序列化类T_Message
            T_SupplyRange SupplyRange = JsonConvert.DeserializeObject<T_SupplyRange>(context.Request.Form["JsonSupplyCode"].ToString());


            //校验T_Message类关键参数是否为空
            if (!_Validation.EditSupplyRange(strLanId, SupplyRange, ref strError))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - EditSupplyRange");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }


            context.Response.Write(new AppPortal().EditSupplyRange(strLanId, SupplyRange));
            return;
        }

        /// <summary>
        /// 销售端首页
        /// </summary>
        /// <param name="context"></param>
        public void SelectSalesFirst(HttpContext context)
        {
            
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            string strFromId = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectClientFirst");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            if (!string.IsNullOrWhiteSpace(context.Request.Form["FromId"]))
            {
                strFromId = context.Request.Form["FromId"].ToString();
            }
            string strLoginId = context.Request.Form["tauLoginId"].ToString();

            context.Response.Write(new AppPortal().SelectSalesFirst(strLanId, strLoginId, strFromId));
        }

        /// <summary>
        /// 查询客户接口
        /// </summary>
        /// <param name="context"></param>
        public void SelectClients(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectClients");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion;

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - SelectClients");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strLoginId = context.Request.Form["tauLoginId"].ToString();

            context.Response.Write(new AppPortal().SelectClients(strLanId, strLoginId));
            return;
        }

        /// <summary>
        /// 客户处理
        /// </summary>
        /// <param name="context"></param>
        public void ContactClients(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - ContactClients");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion;

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - ContactClients");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            if (string.IsNullOrWhiteSpace(context.Request.Form["Type"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - ContactClients");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            if (string.IsNullOrWhiteSpace(context.Request.Form["TargetId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - ContactClients");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strLoginId = context.Request.Form["tauLoginId"].ToString();
            string strType = context.Request.Form["Type"].ToString();
            string strTargetId = context.Request.Form["TargetId"].ToString();


            context.Response.Write(new AppPortal().ContactClients(strLanId, strType, strLoginId, strTargetId));
            return;
        }


        /// <summary>
        /// 查询客户关怀、联系记录
        /// </summary>
        /// <param name="context"></param>
        public void SelectConcern(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - ContactClients");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion;

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - ContactClients");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            if (string.IsNullOrWhiteSpace(context.Request.Form["Type"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - ContactClients");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            if (string.IsNullOrWhiteSpace(context.Request.Form["TargetId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - ContactClients");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strLoginId = context.Request.Form["tauLoginId"].ToString();
            string strType = context.Request.Form["Type"].ToString();
            string strTargetId = context.Request.Form["TargetId"].ToString();


            context.Response.Write(new AppPortal().SelectConcern(strLanId, strType, strLoginId, strTargetId));
            return;
        }


        /// <summary>
        /// 更改客户标签
        /// </summary>
        /// <param name="context"></param>
        public void EditClients(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - EditClients");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion;

            if (string.IsNullOrWhiteSpace(context.Request.Form["tauLoginId"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - EditClients");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            if (string.IsNullOrWhiteSpace(context.Request.Form["ClientLevel"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - EditClients");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            string strLoginId = context.Request.Form["tauLoginId"].ToString();
            string strLevel = context.Request.Form["ClientLevel"].ToString();

            context.Response.Write(new AppPortal().EditClients(strLanId, strLevel, strLoginId));
            return;
        }

        /// <summary>
        /// 分供商提交异常
        /// </summary>
        /// <param name="context"></param>
        public void CreateException(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectSystemArgs");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion;

            
            //检查参数JsonSupplyRange类及OperationType是否都有值
            if (string.IsNullOrWhiteSpace(context.Request.Form["JsonException"]))
            {
                //获取多语言提示
                strTips = _commonhelp.GetTips("4", strLanId);
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strTips, "AshxPortalRequest - CreateException");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            
            //反序列化类T_Message
            T_Exception Exception = JsonConvert.DeserializeObject<T_Exception>(context.Request.Form["JsonException"].ToString());



            //校验T_Message类关键参数是否为空
            if (!_Validation.CreateException(strLanId, Exception, ref strError))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", strError, "AshxPortalRequest - CreateException");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }


            context.Response.Write(new AppPortal().CreateException(strLanId, Exception));
            return;
        }

        /// <summary>
        /// 查询异常
        /// </summary>
        /// <param name="context"></param>
        public void SelectException(HttpContext context)
        {
            #region 公共部分
            context.Response.ContentType = "text/plain";
            string strError = "";
            string strLanId = "";
            string strTips = "";
            if (string.IsNullOrWhiteSpace(context.Request.Form["LanId"]))
            {
                JObject jObj = new JObject();
                jObj = Common.Return("-1", "语言Id不能为空", "AshxPortalRequest - SelectException");
                context.Response.Write(JsonConvert.SerializeObject(jObj));
                return;
            }
            strLanId = context.Request.Form["LanId"].ToString();
            #endregion

            string strContractId = "";
            string strExid = "";

            if(!string.IsNullOrWhiteSpace(context.Request.Form["ContractId"]))
            {
                strContractId=context.Request.Form["ContractId"];
            }

            if (!string.IsNullOrWhiteSpace(context.Request.Form["Exid"]))
            {
                strExid = context.Request.Form["Exid"];
            }

            context.Response.Write(new AppPortal().SelectException(strLanId, strContractId, strExid));
            return;
        }

        #endregion

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}